package service

import (
	"context"
	"gitee.com/tools/internal/domain"
	"gitee.com/tools/internal/service/IP"
)

type SelectService interface {
	SelectIp(ctx context.Context, ip string) (domain.IpInfo, error)
	SelectPhone(ctx context.Context, mobile string, status string) (domain.MPhone, error)
	SelectCountryCode(ctx context.Context, words string, t string) (domain.CountryCode, error)
	SelectDns(ctx context.Context, req domain.Dns) (string, error)
	SelectDomainWeight(ctx context.Context, domain string) (domain.DomainWeight, error)
}

type SelectSvc struct {
	Isp IP.Ip
}

func (s *SelectSvc) SelectDomainWeight(ctx context.Context, domain string) (domain.DomainWeight, error) {
	return s.Isp.QueryDomainWeight(ctx, domain)
}
func (s *SelectSvc) SelectDns(ctx context.Context, req domain.Dns) (string, error) {
	return s.Isp.QueryDns(ctx, req)
}

func (s *SelectSvc) SelectCountryCode(ctx context.Context, words string, t string) (domain.CountryCode, error) {
	return s.Isp.QueryCountryCode(ctx, words, t)
}

func (s *SelectSvc) SelectIp(ctx context.Context, ip string) (domain.IpInfo, error) {
	return s.Isp.QueryIp(ctx, ip)
}

func (s *SelectSvc) SelectPhone(ctx context.Context, mobile string, status string) (domain.MPhone, error) {
	return s.Isp.QueryPhone(ctx, mobile, status)
}

func NewSelectSvc(Isp IP.Ip) SelectService {
	return &SelectSvc{
		Isp: Isp,
	}
}
